home *** CD-ROM | disk | FTP | other *** search
- /* INTR.C --- p. 635 */
- #include <stdio.h>
- #include <dos.h>
- /* Interrupt number for DOS functions */
- #define DOS_INT 0x21
- /* DOS "change directory" function */
- #define DOS_CHDIR 0x3b
- /* Buffer to hold path name */
- static char buff[80];
- main()
- {
- /* Far pointer to directory name string*/
- char *dirname;
- /* Set up the structure for registers */
- struct regpack regs;
- printf("Enter pathname: ");
- gets(buff);
- /* Set up far pointer to name*/
- dirname = &buff[0];
- regs.r_ax = DOS_CHDIR << 8;
- /* Offset of string to DX */
- regs.r_dx = FP_OFF(dirname);
- /* Segment of string to DS */
- regs.r_ds = FP_SEG(dirname);
- intr(DOS_INT, ®s);
- }